require 'rubygems'
gem 'soap4r'
require 'soap/wsdlDriver'
require 'soap/header/simplehandler'
require 'defaultDriver.rb'
require 'authStub.rb'
require 'WSHelpers.rb'

props = {
  :object => 'List',
  :props => ['ListName','Description','Type','ID','CustomerKey']
}

filter = {
  :filterType => 'Simple',
  :filter => ['CustomerKey','equals','API-TestList-4']
}

lists = BuildRetrieve.new
resp = lists.creates(props,filter)
customerKey = String.new
id = String.new
resp.results.each do |result|
  customerKey = result.customerKey
  id = result.iD
end

#Async create options
#options = CreateOptions.new(nil,nil,nil,nil,nil,nil,nil,nil,'Asynchronous')
options = nil

subObjs = []
5.times do |i|
  email = "api-test-#{i}958@bh.exacttarget.com"
  subkey = "api-test#{i}958"
  list = SubscriberList.new(nil,nil,nil,nil,nil,id,nil,customerKey,nil,nil,'Active',nil,'Create',nil)
  subObjs.push(Subscriber.new(nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,email,nil,subkey,nil,nil,nil,nil,[list],nil,nil,nil,nil,nil,nil,nil))
end
apiObj = subObjs

resp = $driver.create(CreateRequest.new(options,[*apiObj]))